function loadKml(viewer) {
    var geocachePromise = Cesium.KmlDataSource.load(
        "models/dibiao.kml", {
            camera: viewer.scene.camera,
            canvas: viewer.scene.canvas,
        });
    geocachePromise.then(function (dataSource) {
        viewer.dataSources.add(dataSource);
        var geocacheEntities = dataSource.entities.values;
        for (var i = 0; i < geocacheEntities.length; i++) {
            var entity = geocacheEntities[i];
            
            if (Cesium.defined(entity.billboard)) {
                entity.billboard.verticalOrigin = Cesium.VerticalOrigin.BOTTOM;
                entity.label = undefined;
                
                entity.billboard.distanceDisplayCondition = new Cesium.DistanceDisplayCondition(10.0, 20000.0);
                var cartographicPosition = Cesium.Cartographic.fromCartesian(entity.position.getValue(Cesium.JulianDate.now()));
                var latitude = Cesium.Math.toDegrees(cartographicPosition.latitude);
                var longitude = Cesium.Math.toDegrees(cartographicPosition.longitude);
                viewer.entities.add(entity)               
            }
        }
    })
}

export default loadKml;